Tile-based optical flow

ABSTRACT

A computing device may determine a per-tile motion estimate between a first m×n pixel tile from a first captured image of a scene and a second m×n pixel tile from a second captured image of the scene. A per-tile confidence of the per-tile motion estimate may be obtained. The per-tile motion estimate and the per-tile confidence may be upsampled to obtain respective per-pixel motion estimates and associated per-pixel confidences for pixels of the first m×n pixel tile. The respective per-pixel motion estimates and associated per-pixel confidences may be iteratively filtered. The iterative filtering may involve multiplying the respective per-pixel motion estimates and associated per-pixel confidences by an affinity matrix. The iterative filtering may also smooth the respective per-pixel motion estimates and associated per-pixel confidences.

BACKGROUND

Digital imaging may refer to capturing and representing the color and brightness characteristics of scenes in digital images (e.g., photographs or motion video). When two or more digital images of a particular scene are captured, some of these digital images may be further enhanced and/or combined to create new digital images or image effects. However, before this processing takes place, it is often beneficial to align groups of digital images. In this way, the relative locations of similar features in each digital image can be taken into account.

SUMMARY

Digital imaging devices, such as wireless computing devices, digital cameras, head-mounted displays, and so on, may capture arrays of digital images of a scene. These digital images may be captured consecutively in time, perhaps a few milliseconds apart from one another. Alternatively or additionally, the digital images may be captured at approximately the same time, but with more than one image sensor. In the latter cases, for instance, a wireless computing device may include multiple individual image sensors, or multiple digital cameras may be arranged to capture digital images in a coordinated fashion.

Thus, a series of two or more digital images of a particular scene may represent temporally or spatially distinct versions of the scene. The information in these images may be used to enhance one another, or to synthesize new digital images of the scene. For instance, information in two of the digital images may merged to create an enhanced version of the scene that is sharper, or exhibits less noise, than any of the digital images in their original form. In another example, a third digital image may be interpolated from two of the captured digital images. This interpolated image may be a synthetic digital image that represents the scene at a point in time between when the two digital images were captured, or a view of the scene from a virtual camera.

Regardless of the application, synthesizing new digital images based on two or more captured digital images may involve aligning parts of the two or more digital images to one another. It is desirable for this alignment procedure to be computationally efficient so that it can operate in real-time, or near-real-time, on various types of image capture devices.

Accordingly, a first example embodiment may involve determining a per-tile motion estimate between a first m×n pixel tile from a first captured image of a scene and a second m×n pixel tile from a second captured image of the scene. The per-tile motion estimate may represent movement of the first m×n pixel tile to approximate the second m×n pixel tile. The first example embodiment may also involve, possibly based on the approximation of the first m×n pixel tile to the second m×n pixel tile, estimating a per-tile confidence of the per-tile motion estimate. The first example embodiment may further involve upsampling the per-tile motion estimate and the per-tile confidence to obtain respective per-pixel motion estimates and associated per-pixel confidences for pixels of the first m×n pixel tile. The first example embodiment may further involve iteratively filtering the respective per-pixel motion estimates and associated per-pixel confidences. The iterative filtering may involve multiplying the respective per-pixel motion estimates and associated per-pixel confidences by an affinity matrix. The iterative filtering may smooth the respective per-pixel motion estimates and associated per-pixel confidences.

In a second example embodiment, an article of manufacture may include a non-transitory computer-readable medium, having stored thereon program instructions that, upon execution by a computing device, cause the computing device to perform operations in accordance with the first example embodiment.

In a third example embodiment, a computing device may include at least one processor, as well as data storage and program instructions. The program instructions may be stored in the data storage, and upon execution by the at least one processor may cause the computing device to perform operations in accordance with the first example embodiment.

In a fourth example embodiment, a system may include various means for carrying out each of the operations of any of the first, second, and/or third example embodiments.

These as well as other embodiments, aspects, advantages, and alternatives will become apparent to those of ordinary skill in the art by reading the following detailed description, with reference where appropriate to the accompanying drawings. Further, it should be understood that this summary and other descriptions and figures provided herein are intended to illustrate embodiments by way of example only and, as such, that numerous variations are possible. For instance, structural elements and process steps can be rearranged, combined, distributed, eliminated, or otherwise changed, while remaining within the scope of the embodiments as claimed.

BRIEF DESCRIPTION OF THE DRAWINGS

FIG. 1 depicts front, right side, and rear views of a digital camera device, according to example embodiments.

FIG. 2 depicts a block diagram of a computing device with image capture capability, according to example embodiments.

FIG. 3 depicts processing of captured images, according to example embodiments.

FIG. 4 depicts generation of synthetic images, according to example embodiments.

FIG. 5 depicts estimating locations of a tile in a larger image portion, according to example embodiments.

FIG. 6 depicts generation of synthetic images, according to example embodiments.

FIG. 7 is a flow chart, according to example embodiments.

FIG. 8 is another flow chart, according to example embodiments.

FIG. 9 represents an example visualization of adaptive per-pixel assignment to tile flows, according to example embodiments.

FIG. 10 depicts an algorithm, according to example embodiments.

FIG. 11 depicts another algorithm, according to example embodiments.

FIG. 12 depicts an optical flow technique being applied to a pair of images, according to example embodiments.

FIG. 13 is yet another flow chart, according to example embodiments.

DETAILED DESCRIPTION

Example methods, devices, and systems are described herein. It should be understood that the words “example” and “exemplary” are used herein to mean “serving as an example, instance, or illustration.” Any embodiment or feature described herein as being an “example” or “exemplary” is not necessarily to be construed as preferred or advantageous over other embodiments or features. Other embodiments can be utilized, and other changes can be made, without departing from the scope of the subject matter presented herein.

Thus, the example embodiments described herein are not meant to be limiting. Aspects of the present disclosure, as generally described herein, and illustrated in the figures, can be arranged, substituted, combined, separated, and designed in a wide variety of different configurations, all of which are contemplated herein.

Further, unless context suggests otherwise, the features illustrated in each of the figures may be used in combination with one another. Thus, the figures should be generally viewed as component aspects of one or more overall embodiments, with the understanding that not all illustrated features are necessary for each embodiment.

1. EXAMPLE IMAGE CAPTURE DEVICES

As image capture devices, such as cameras, become more popular, they may be employed as standalone hardware devices or integrated into various other types of devices. For instance, still and video cameras are now regularly included in wireless computing devices (e.g., mobile phones), tablet computers, laptop computers, video game interfaces, home automation devices, and even automobiles and other types of vehicles.

The physical components of a camera may include one or more apertures through which light enters, one or more recording surfaces for capturing the images represented by the light, and lenses positioned in front of each aperture to focus at least part of the image on the recording surface(s). The apertures may be fixed size or adjustable. In an analog camera, the recording surface may be photographic film. In a digital camera, the recording surface may include an electronic image sensor (e.g., a charge coupled device (CCD) or a complementary metal-oxide-semiconductor (CMOS) sensor) to transfer and/or store captured images in a data storage unit (e.g., memory).

One or more shutters may be coupled to or nearby the lenses or the recording surfaces. Each shutter may either be in a closed position, in which it blocks light from reaching the recording surface, or an open position, in which light is allowed to reach to recording surface. The position of each shutter may be controlled by a shutter button. For instance, a shutter may be in the closed position by default. When the shutter button is triggered (e.g., pressed), the shutter may change from the closed position to the open position for a period of time, known as the shutter cycle. During the shutter cycle, an image may be captured on the recording surface. At the end of the shutter cycle, the shutter may change back to the closed position.

Alternatively, the shuttering process may be electronic. For example, before an electronic shutter of a CCD image sensor is “opened,” the sensor may be reset to remove any residual signal in its photodiodes. While the electronic shutter remains open, the photodiodes may accumulate charge. When or after the shutter closes, these charges may be transferred to longer-term data storage. Combinations of mechanical and electronic shuttering may also be possible.

Regardless of type, a shutter may be activated and/or controlled by something other than a shutter button. For instance, the shutter may be activated by a softkey, a timer, or some other trigger. Herein, the term “image capture” may refer to any mechanical and/or electronic shuttering process that results in one or more images being recorded, regardless of how the shuttering process is triggered or controlled.

The exposure of a captured image may be determined by a combination of the size of the aperture, the brightness of the light entering the aperture, and the length of the shutter cycle (also referred to as the shutter length or the exposure length). Additionally, a digital and/or analog gain may be applied to the image, thereby influencing the exposure. In some embodiments, the term “total exposure length” or “total exposure time” may refer to the shutter length multiplied by the gain for a particular aperture size. Herein, the term “total exposure time,” or “TET,” should be interpreted as possibly being a shutter length, an exposure time, or any other metric that controls the amount of signal response that results from light reaching the recording surface.

A still camera may capture one or more images each time image capture is triggered. A video camera may continuously capture images at a particular rate (e.g., 24 images—or frames—per second) as long as image capture remains triggered (e.g., while the shutter button is held down). Some digital still cameras may open the shutter when the camera device or application is activated, and the shutter may remain in this position until the camera device or application is deactivated. While the shutter is open, the camera device or application may capture and display a representation of a scene on a viewfinder. When image capture is triggered, one or more distinct digital images of the current scene may be captured.

Cameras—even analog cameras—may include software to control one or more camera functions and/or settings, such as aperture size, TET, gain, and so on. Additionally, some cameras may include software that digitally processes images during or after these images are captured. While the description above refers to cameras in general, it may be particularly relevant to digital cameras.

As noted previously, digital cameras may be standalone devices or integrated with other devices. As an example, FIG. 1 illustrates the form factor of a digital camera device 100. Digital camera device 100 may be, for example, a mobile phone, a tablet computer, or a wearable computing device. However, other embodiments are possible. Digital camera device 100 may include various elements, such as a body 102, a front-facing camera 104, a multi-element display 106, a shutter button 108, and other buttons 110. Digital camera device 100 could further include a rear-facing camera 112. Front-facing camera 104 may be positioned on a side of body 102 typically facing a user while in operation, or on the same side as multi-element display 106. Rear-facing camera 112 may be positioned on a side of body 102 opposite front-facing camera 104. Referring to the cameras as front and rear facing is arbitrary, and digital camera device 100 may include multiple cameras positioned on various sides of body 102.

Multi-element display 106 could represent a cathode ray tube (CRT) display, a light emitting diode (LED) display, a liquid crystal (LCD) display, a plasma display, or any other type of display known in the art. In some embodiments, multi-element display 106 may display a digital representation of the current image being captured by front-facing camera 104 and/or rear-facing camera 112, or an image that could be captured or was recently captured by either or both of these cameras. Thus, multi-element display 106 may serve as a viewfinder for either camera. Multi-element display 106 may also support touchscreen and/or presence-sensitive functions that may be able to adjust the settings and/or configuration of any aspect of digital camera device 100.

Front-facing camera 104 may include an image sensor and associated optical elements such as lenses. Front-facing camera 104 may offer zoom capabilities or could have a fixed focal length. In other embodiments, interchangeable lenses could be used with front-facing camera 104. Front-facing camera 104 may have a variable mechanical aperture and a mechanical and/or electronic shutter. Front-facing camera 104 also could be configured to capture still images, video images, or both. Further, front-facing camera 104 could represent a monoscopic, stereoscopic, or multiscopic camera. Rear-facing camera 112 may be similarly or differently arranged. Additionally, front-facing camera 104, rear-facing camera 112, or both, may be an array of one or more cameras.

Either or both of front facing camera 104 and rear-facing camera 112 may include or be associated with an illumination component that provides a light field to illuminate a target object. For instance, an illumination component could provide flash or constant illumination of the target object. An illumination component could also be configured to provide a light field that includes one or more of structured light, polarized light, and light with specific spectral content. Other types of light fields known and used to recover three-dimensional (3D) models from an object are possible within the context of the embodiments herein.

Either or both of front facing camera 104 and rear-facing camera 112 may include or be associated with an ambient light sensor that may continuously or from time to time determine the ambient brightness of a scene that the camera can capture. In some devices, the ambient light sensor can be used to adjust the display brightness of a screen associated with the camera (e.g., a viewfinder). When the determined ambient brightness is high, the brightness level of the screen may be increased to make the screen easier to view. When the determined ambient brightness is low, the brightness level of the screen may be decreased, also to make the screen easier to view as well as to potentially save power. Additionally, the ambient light sensor's input may be used to determine a TET of an associated camera, or to help in this determination.

Digital camera device 100 could be configured to use multi-element display 106 and either front-facing camera 104 or rear-facing camera 112 to capture images of a target object. The captured images could be a plurality of still images or a video stream. The image capture could be triggered by activating shutter button 108, pressing a softkey on multi-element display 106, or by some other mechanism. Depending upon the implementation, the images could be captured automatically at a specific time interval, for example, upon pressing shutter button 108, upon appropriate lighting conditions of the target object, upon moving digital camera device 100 a predetermined distance, or according to a predetermined capture schedule.

As noted above, the functions of digital camera device 100—or another type of digital camera—may be integrated into a computing device, such as a wireless computing device, cell phone, tablet computer, laptop computer and so on. For purposes of example, FIG. 2 is a simplified block diagram showing some of the components of an example computing device 200 that may include camera components 224.

By way of example and without limitation, computing device 200 may be a cellular mobile telephone (e.g., a smartphone), a still camera, a video camera, a fax machine, a computer (such as a desktop, notebook, tablet, or handheld computer), a personal digital assistant (PDA), a home automation component, a digital video recorder (DVR), a digital television, a remote control, a wearable computing device, or some other type of device equipped with at least some image capture and/or image processing capabilities. It should be understood that computing device 200 may represent a physical camera device such as a digital camera, a particular physical hardware platform on which a camera application operates in software, or other combinations of hardware and software that are configured to carry out camera functions.

As shown in FIG. 2, computing device 200 may include a communication interface 202, a user interface 204, a processor 206, data storage 208, and camera components 224, all of which may be communicatively linked together by a system bus, network, or other connection mechanism 210.

Communication interface 202 may allow computing device 200 to communicate, using analog or digital modulation, with other devices, access networks, and/or transport networks. Thus, communication interface 202 may facilitate circuit-switched and/or packet-switched communication, such as plain old telephone service (POTS) communication and/or Internet protocol (IP) or other packetized communication. For instance, communication interface 202 may include a chipset and antenna arranged for wireless communication with a radio access network or an access point. Also, communication interface 202 may take the form of or include a wireline interface, such as an Ethernet, Universal Serial Bus (USB), or High-Definition Multimedia Interface (HDMI) port. Communication interface 202 may also take the form of or include a wireless interface, such as a Wifi, BLUETOOTH®, global positioning system (GPS), or wide-area wireless interface (e.g., WiMAX or 3GPP Long-Term Evolution (LTE)). However, other forms of physical layer interfaces and other types of standard or proprietary communication protocols may be used over communication interface 202. Furthermore, communication interface 202 may comprise multiple physical communication interfaces (e.g., a Wifi interface, a BLUETOOTH® interface, and a wide-area wireless interface).

User interface 204 may function to allow computing device 200 to interact with a human or non-human user, such as to receive input from a user and to provide output to the user. Thus, user interface 204 may include input components such as a keypad, keyboard, touch-sensitive or presence-sensitive panel, computer mouse, trackball, joystick, microphone, and so on. User interface 204 may also include one or more output components such as a display screen which, for example, may be combined with a presence-sensitive panel. The display screen may be based on CRT, LCD, and/or LED technologies, or other technologies now known or later developed. User interface 204 may also be configured to generate audible output(s), via a speaker, speaker jack, audio output port, audio output device, earphones, and/or other similar devices.

In some embodiments, user interface 204 may include a display that serves as a viewfinder for still camera and/or video camera functions supported by computing device 200. Additionally, user interface 204 may include one or more buttons, switches, knobs, and/or dials that facilitate the configuration and focusing of a camera function and the capturing of images (e.g., capturing a picture). It may be possible that some or all of these buttons, switches, knobs, and/or dials are implemented by way of a presence-sensitive panel.

Processor 206 may comprise one or more general purpose processors—e.g., microprocessors—and/or one or more special purpose processors—e.g., digital signal processors (DSPs), graphics processing units (GPUs), floating point units (FPUs), network processors, or application-specific integrated circuits (ASICs). In some instances, special purpose processors may be capable of image processing, image alignment, and merging images, among other possibilities. Data storage 208 may include one or more volatile and/or non-volatile storage components, such as magnetic, optical, flash, or organic storage, and may be integrated in whole or in part with processor 206. Data storage 208 may include removable and/or non-removable components.

Processor 206 may be capable of executing program instructions 218 (e.g., compiled or non-compiled program logic and/or machine code) stored in data storage 208 to carry out the various functions described herein. Therefore, data storage 208 may include a non-transitory computer-readable medium, having stored thereon program instructions that, upon execution by computing device 200, cause computing device 200 to carry out any of the methods, processes, or operations disclosed in this specification and/or the accompanying drawings. The execution of program instructions 218 by processor 206 may result in processor 206 using data 212.

By way of example, program instructions 218 may include an operating system 222 (e.g., an operating system kernel, device driver(s), and/or other modules) and one or more application programs 220 (e.g., camera functions, address book, email, web browsing, social networking, and/or gaming applications) installed on computing device 200. Similarly, data 212 may include operating system data 216 and application data 214. Operating system data 216 may be accessible primarily to operating system 222, and application data 214 may be accessible primarily to one or more of application programs 220. Application data 214 may be arranged in a file system that is visible to or hidden from a user of computing device 200.

Application programs 220 may communicate with operating system 222 through one or more application programming interfaces (APIs). These APIs may facilitate, for instance, application programs 220 reading and/or writing application data 214, transmitting or receiving information via communication interface 202, receiving and/or displaying information on user interface 204, and so on.

In some vernaculars, application programs 220 may be referred to as “apps” for short. Additionally, application programs 220 may be downloadable to computing device 200 through one or more online application stores or application markets. However, application programs can also be installed on computing device 200 in other ways, such as via a web browser or through a physical interface (e.g., a USB port) on computing device 200.

Camera components 224 may include, but are not limited to, an aperture, shutter, recording surface (e.g., photographic film and/or an image sensor), lens, and/or shutter button. Camera components 224 may be controlled at least in part by software executed by processor 206.

2. EXAMPLE IMAGE ALIGNMENT

A variety of image processing operations depend on being able to determine which pixels correspond to one another in two images. To this end, the embodiments herein provide techniques for efficiently matching patches of pixels in one image to locations in another image. A “patch” of pixels may refer to a group of one or more pixels from the same general location in an image. Naïve approaches to solving this problem are prohibitively expensive in terms of computation. But, the embodiments herein are efficient and fast, capable of processing high-resolution images (e.g., 15 megapixels or more) in less than a second.

Given the determined patch-to-location matches in the two images, a new image filtering technique, in some cases based on Kalman filtering, can produce accurate per-pixel motion and matching estimates. This matching procedure can be used for a variety of purposes, such as motion estimation and for merging multiple images.

FIG. 3 includes example captured images 300 and 302. Both of these images depict a landscape containing a person and a cloud. In captured image 302, the person and the cloud are both slightly to the left of where they are in captured image 300. Therefore, captured images 300 and 302 may have been captured by the same image sensor at different points in time (e.g., a few milliseconds or seconds apart from one another). Alternatively or additionally, captured images 300 and 302 may have been captured at the same time or approximately the same time, but with two different image sensors. These two image sensors may be spatially separated so that captured images 300 and 302 are captured from different angles.

Regardless, some image processing techniques may involve taking information from both captured images 300 and 302, and merging this information into synthetic image 304. For instance, information from captured images 300 and 302 can be combined into synthetic image 304 to create a sharpened or de-noised image.

Alternatively, to the extent that captured images 300 and 302 depict movement, synthetic image 304 may be an interpolation of an intermediate point of this movement. For instance, if captured images 300 and 302 are video frames of a sequence of captured video frames, synthetic image 304 may approximate an intermediate video frame of this sequence. Thus, if captured images 300 and 302 were captured 30 milliseconds apart from one another, synthetic image 304 may approximate a video frame that, hypothetically, could have been captured 15 milliseconds after captured image 300 and 15 milliseconds before captured image 302. By synthesizing one or more of such intermediate video frames, a slow motion video sequence can be created.

In another alternative, captured images 300 and 302 may have been captured by two spatially separated image sensors. In this case, synthetic image 304 may approximate an image captured by a virtual image sensor positioned at an intermediate location between the two “real” image sensors. By doing so, the scene depicted in the images may be viewed from more camera angles than were used for the actual capture of the images.

Regardless of how this sort of image synthesis is used, it is beneficial to first align captured images 300 and 302. In its simplest form, this alignment may involve shifting each pixel of one image by a certain number of pixel or sub-pixel offsets in the x and y directions, respectively. However, this simple approach usually results in a poor alignment, because different pixels may actually move by different offsets. A more robust alignment technique is to determine the x and y offsets for each pixel individually. However, for large images, such as 4, 6, 8, or 15 megapixel images, doing so may be computationally prohibitive.

Herein, a new image alignment technique is disclosed. A first image (e.g., captured image 300) is divided into non-overlapping square or rectangular tiles. The tiles are mapped to respective offsets that identify locations in a second image (e.g., captured image 302). These mappings are approximated with bivariate quadratic surfaces (i.e., two-dimensional quadratic functions), incorporating confidence levels of the mappings. However, it may be possible to use different types of functions in some situations. An information filtering technique (e.g., based on Kalman filters) may be applied to the surfaces, resulting in a per-pixel offset for each pixel in the first image, where the offsets represents the movement of the pixel between the first image and the second image.

As a result, the first image can be warped into alignment with the second image, or the second image can be warped into alignment with the first image. By merging information from the aligned images, sharpened or de-noised versions of these images may be created. Alternatively or additionally, synthetic images representing temporal-intermediate or spatially-intermediate versions of the scene may be created.

As an example of synthesizing an intermediate image from two captured images, consider FIG. 4. Part (a) and part (b) of this figure show respective first and second images. Part (c) shows a synthetic image formed by averaging the pixel values of the first and second images, without per-pixel alignment. This naïve technique produces significant ghosting (objects blending into each other due to image misalignment), as the bird's head and wings are blurred. Part (d) shows another synthetic image formed by using the warping alignment embodiments described herein, as well as edge-aware filtering (described in more detail below). The outcome is an intermediate image with much less ghosting.

Example embodiments of the alignment technique are described in detail in the following sections.

3. TILE-BASED ANALYSIS

As an example, consider the problem of taking two small sub-images, each from a different captured image of a scene, and computing a “distance matrix” that measures the mismatch between the two sub-images for various offsets (translations) of the sub-images. Entries in the distance matrix indicate the relatively goodness-of-fit of the offsets of the two sub-images. The offsets that minimizes distance measure used to create the matrix is likely to be a reasonably accurate estimate of the motion that transforms the first sub-image into the second sub-image.

A. Example Determination of a Distance Matrix

In order to formally define the distance matrix, a simplified example may be helpful. The L2 distance between two vectors a and b may be calculated as:

$\begin{matrix} {d = {{a - b}}_{2}^{2}} & (1) \end{matrix}$ Where ∥x∥₂=√{square root over (Σ_(i)|x_(i)|²)}. The L2 distance may also be referred to as the L2 norm or Euclidian norm.

This distance can be rewritten as:

$\begin{matrix} \begin{matrix} {d = {{a - b}}_{2}^{2}} \\ {= {\sum\limits_{i}\left( {a_{i} - b_{i}} \right)^{2}}} \\ {= {\sum\limits_{i}{\left( {a_{i} - b_{i}} \right)\left( {a_{i} - b_{i}} \right)}}} \\ {= {\sum\limits_{i}\left( {a_{i}^{2} + b_{i}^{2} - {2a_{i}b_{i}}} \right)}} \\ {= {{a}_{2}^{2} + {b}_{2}^{2} - {2\; a^{T}b}}} \end{matrix} & (2) \end{matrix}$

Thus, the squared L2 distance between two vectors decouples into the squared L2 norm of each vector, minus twice the inner product of the two vectors.

Relating this to image alignment, a distance matrix may be generated for an n×n image tile T being mapped to a p×p image portion I, where p>n. In other words, the distance matrix may contain distances relating to respective fits between tile T and each n×n sub-image of image portion I. Note that image portion I may be a whole image, or any portion of the image that is bigger than tile T.

For purposes of simplicity, throughout the following discussion, image T and image portion I are assumed to be square. However, either or both of these could be rectangular instead. Thus, tile T could be m×n, and image portion I could be p×q. Further, the following discussion also assumes that image T and image portion I are grayscale for convenience, though the techniques described herein may be generalized to color images.

Formally, it would be desirable to generate a (p−n+1)×(p−n+1) distance matrix D, such that: D(u,v)=Σ_(x=0) ^(n-1)Σ_(y=0) ^(n-1)(T(x,y)−I(x+u,y+v))²  (3) Where T(x,y) is the value of the pixel at the (x,y) position of tile T, and I(x+u, y+v) is the value of the pixel at the (x+u, y+v) position of image portion I. This calculation can be simplified as follows: D(u,v)=Σ_(x=0) ^(n-1)Σ_(y=0) ^(n-1)(T(x,y)²+Σ_(x=0) ^(n-1)Σ_(y=0) ^(n-1) I(x+u,y+v)²−2Σ_(x=0) ^(n-1)Σ_(y=0) ^(n-1)(T(x,y)I(x+u,y+v)  (4)

The first term depends only on T and not at all on u or v, and so it can be computed once and re-used when computing each value of D (u,v). The second term can be computed for all values of (u,v) by box filtering I(x,y)², which can be done efficiently using sliding-window image filtering techniques or using integral images. The third term can also be computed for all values of (u,v) by cross-correlating I and T.

In general, box filtering of an image applies a linear filter to an input image such that each pixel in the filtered image has a value equal to the average value of its neighboring pixels in the input image. For instance, a 3×3 box filter can be applied to each pixel of the input image to blur, sharpen, detect edges, and perform other effects to the input image. Here, the box filter is applied to I squared.

Cross-correlation can be expensive to compute naively, but can be sped up significantly by using fast Fourier transforms (FFTs). From the convolution theorem: a*b=

⁻¹ {

{a}*∘

{b}}  (5) Where

is the Fourier transform,

⁻¹ is the inverse Fourier transform, ∘ is the pointwise product of two vectors, and

{a}* is the conjugate transpose of

{a}.

Based on these observations, D can be expressed, for all offsets (u,v), as:

D =  T  2 2 + box ⁢ ⁢ filter ⁢ ⁢ ( I 2 , n ) - 2 ⁢ - 1 ⁢ { ⁢ { I } * ⁢ ⁢ • ⁢ ⁢ ⁢ { T } } ( 6 )

Where the first term is the sum of the squared elements of T, the second term is the squared elements of image portion I filtered with a box filter of size n×n (where the box filter is not normalized), and the third term is based on the cross-correlation of I and T, computed efficiently using an FFT.

B. Example Quadratic Approximation of the Distance Matrix

A distance matrix D (u,v) contains a rich amount of information describing how well matched tile T and image portion I are for all possible translations. This is a powerful description, but it is also a large and somewhat unwieldy representation. For a 32×32 pixel tile T (the tile being matched) and a 64×64 image portion I (the image portion being searched for a match with tile T), there is a 33×33 distance matrix D. Given that a goal is to find the single best match between tile T and image portion I, it is desirable to produce a simplified representation of distance matrix D by fitting a simple function to distance matrix D near the location of its minimum. The minimum of distance matrix D indicates the x and y direction offsets of the best determined fit between tile T and image portion I.

In order to provide a compact representation of distance matrix D, a two-dimensional polynomial, such as a bivariate quadratic surface, can be fit at or near the entry in distance matrix D that has the minimum value of all entries in distance matrix D. If multiple minima exist, any one may be chosen. This quadratic surface may be useful in a variety of ways. Such a quadratic surface could be used to estimate the sub-pixel location of the minimum of distance matrix D, which is more accurate than simply taking the per-pixel location as the minimum for most motion-estimation tasks. Additionally, a quadratic approximation could also be used as a compact approximation to distance matrix D in a more sophisticated motion estimation algorithm, such as an optical flow algorithm. In optical flow algorithms, for example, the relative confidences of respective motion estimates are used to weigh these estimates.

To clarify, distance matrix D may be viewed as an error surface that is to be approximated by a bivariate quadratic surface, where D (u,v) is the L2 distance between the tile T and image portion I when the tile T is offset (e.g., shifted) by (u,v) in the image portion I. This approximation should accurately model the shape of distance matrix D near a minimum, and it is acceptable for the approximation to be poor far from this minimum. In most cases, distance matrix D, as a whole, is poorly modeled with a single bivariate quadratic surface. But for the purposes herein, since the goal is to have a reasonably accurate fit near the minimum, less accurate fits away from the minimum are not problematic.

More formally, distance matrix D can be approximated as follows:

$\begin{matrix} {{D^{\prime}\left( {u,v} \right)} \approx {{{\frac{1}{2}\left\lbrack {u;v} \right\rbrack}^{2}{A\left\lbrack {u;v} \right\rbrack}} + {b^{T}\left\lbrack {u;v} \right\rbrack} + c}} & (7) \end{matrix}$ Where A is a 2×2 positive semi-definite matrix (PSD), b is a 2×1 vector, and c is a scalar value.

A matrix M is PSD if the expression z^(T)Mz is non-negative for every non-zero column vector z of n real numbers. A is assumed to be PSD because the shape of D′ near its minimum is expected to be an upward-facing quadratic surface, rather than a saddle or a downward-facing surface.

Let (û,{circumflex over (v)}) be the coordinate of a minimum entry in distance matrix D. A 3×3 area around (û,{circumflex over (v)}), D_(sub), can be used when fitting the bivariate quadratic surface. Thus,

$\begin{matrix} {D_{sub} = \begin{bmatrix} {D\left( {{\hat{u} - 1},{\hat{v} - 1}} \right)} & {D\left( {\hat{u},{\hat{v} - 1}} \right)} & {D\left( {{\hat{u} + 1},{\hat{v} - 1}} \right)} \\ {D\left( {{\hat{u} - 1},\hat{v}} \right)} & {D\left( {\hat{u},\hat{v}} \right)} & {D\left( {{\hat{u} + 1},\hat{v}} \right)} \\ {D\left( {{\hat{u} - 1},{\hat{v} + 1}} \right)} & {D\left( {\hat{u},{\hat{v} + 1}} \right)} & {D\left( {{\hat{u} + 1},{\hat{v} + 1}} \right)} \end{bmatrix}} & (8) \end{matrix}$

Each pixel in D_(sub) can be weighted according to a 3×3 set of binomial weights:

$\begin{matrix} {W = \begin{bmatrix} 1 & 2 & 1 \\ 2 & 4 & 2 \\ 1 & 2 & 1 \end{bmatrix}} & (9) \end{matrix}$

With D_(sub) and W, a least-squares problem can be set up with respect to the free parameters in the quadratic approximation (A,b,c). Solving such a linear system is computationally expensive to do in practice, but a closed-form solution can be derived for any arbitrary 3×3 error surface with the weighting W. This solution is expressible in terms of six 3×3 filters:

$\begin{matrix} {f_{A_{1,1}} = {\begin{bmatrix} 1 & {- 2} & 1 \\ 4 & {- 8} & 4 \\ 1 & {- 2} & 1 \end{bmatrix}/6}} & (10) \\ {f_{A_{1,2}} = {\begin{bmatrix} 1 & 0 & {- 1} \\ 0 & 0 & 0 \\ {- 1} & 0 & 1 \end{bmatrix}/4}} & (11) \\ {f_{A_{2,2}} = {\begin{bmatrix} 1 & 4 & 1 \\ {- 2} & {- 8} & {- 2} \\ 1 & 4 & 1 \end{bmatrix}/6}} & (12) \\ {f_{b_{1}} = {\begin{bmatrix} {- 1} & 0 & 1 \\ {- 4} & 0 & 4 \\ {- 1} & 0 & 1 \end{bmatrix}/6}} & (13) \\ {f_{b_{2}} = {\begin{bmatrix} {- 1} & {- 4} & {- 1} \\ 0 & 0 & 0 \\ 1 & 4 & 1 \end{bmatrix}/6}} & (14) \\ {f_{c} = {\begin{bmatrix} {- 1} & 2 & {- 1} \\ 2 & 32 & 2 \\ {- 1} & 2 & {- 1} \end{bmatrix}/36}} & (15) \end{matrix}$

The free parameters of the quadratic approximation can be found by taking the inner product of D_(sub) with these filters (assuming the error surface and the filter have been vectorized), or equivalently by computing the cross-correlation of D_(sub) with these filters:

$\begin{matrix} {A = \begin{bmatrix} {f_{A_{1,1}} \cdot D_{sub}} & {f_{A_{1,2}} \cdot D_{sub}} \\ {f_{A_{1,2}} \cdot D_{sub}} & {f_{A_{2,2}} \cdot D_{sub}} \end{bmatrix}} & (16) \\ {b = \begin{bmatrix} {f_{b_{1}} \cdot D_{sub}} \\ {f_{b_{2}} \cdot D_{sub}} \end{bmatrix}} & (17) \\ {c = {f_{c} \cdot D_{sub}}} & (18) \end{matrix}$

Due to image filtering being a linear operation, the bivariate quadratic surface can be fit to a larger area of distance matrix D than a 3×3 section. For instance, it is sufficient to pre-filter distance matrix D with a blur, and then perform the 3×3 operation above on the blurred error surface.

In some cases, depending on the shape of D_(sub), the estimated A might not be positive semi-definite, contrary to the assumption above. To address this issue, the diagonal elements of A can be set as non-negative: A _(1,1)=max(0,A _(1,1))  (19) A _(2,2)=max(0,A _(2,2))  (20)

The determinant of A can be calculated as:

$\begin{matrix} {{\det(A)} = {{A_{1,1}A_{2,2}} - A_{1,2}^{2}}} & (21) \end{matrix}$

If det(A)<0, then the off-diagonal elements of A can be set to be zero. These operations result in an A that is guaranteed to be positive semi-definite.

With this in place, the minimum of the bivariate quadratic surface fit to distance matrix D can be found. To do so, the surface can be rewritten in a different form:

$\begin{matrix} {{{\frac{1}{2}x^{T}A\; x} + {b^{T}x} + c} = {{\frac{1}{2}\left( {x - \mu} \right)^{T}{A\left( {x - \mu} \right)}} + s}} & (22) \\ {Where} & \; \\ {\mu = {{- A^{- 1}}b}} & (23) \\ {s = {c - \frac{\mu^{T}A\;\mu}{2}}} & (24) \end{matrix}$

For a bivariate quadratic surface, this is equivalent to:

$\begin{matrix} {\mu = \frac{\left\lbrack {{{A_{2,2}b_{1}} - {A_{1,2}b_{2}}},{{A_{1,1}b_{2}} - {A_{1,2}b_{1}}}} \right\rbrack^{T}}{{A_{1,1}A_{2,2}} - A_{1,2}^{2}}} & (25) \\ {s = {c - \frac{{A_{1,1}\mu_{1}^{2}} + {2\; A_{1,2}\mu_{1}\mu_{2}} + {A_{2,2}\mu_{2}^{2}}}{2}}} & (26) \end{matrix}$

These expressions can also be solved for b and c:

$\begin{matrix} {b = {{{- A}\;\mu} = {- \left\lbrack {{{A_{1,1}\mu_{1}} + {A_{1,2}\mu_{2}}},{{A_{1,2}\mu_{1}} - {A_{2,2}\mu_{2}}}} \right\rbrack^{T}}}} & (27) \\ {c = {{s + \frac{\mu^{T}A\;\mu}{2}} = {s + \frac{{A_{1,1}\mu_{1}^{2}} + {2\; A_{1,2}\mu_{1}\mu_{2}} + {A_{2,2}\mu_{2}^{2}}}{2}}}} & (28) \end{matrix}$

Once the location of the minimum of the bivariate quadratic surface is determined, that is used as the sub-pixel location of the minimum of distance matrix D. Note that the fitted bivariate quadratic surface treats the center pixel of D_(sub) as (0,0). So, after fitting, the per-pixel minimum location (û,{circumflex over (v)}) is added into μ, which provides the actual location of the minimum in minimum of distance matrix D. In the presence of severe noise or flat images with little texture, it is possible for the predicted sub-pixel minimum μ to be different from the observed per-pixel minimum (û,{circumflex over (v)}). If these two values are sufficiently different (e.g., more than 1 pixel removed), μ is set to [û;{circumflex over (v)}].

C. Example Distance Matrixes and Quadratic Approximations of Real Images

FIG. 5 depicts the determination of distance matrixes and their associated quadratic approximations for three example tiles being matched to three example image portions.

The first column of FIG. 5 shows the three tiles, and the second column shows respective image portions. Each image portion may be searched for one or more matches of its associated tile. The third column shows the distance matrix D for each tile, calculated using Equation (6). The fourth column shows the bivariate quadratic fit to that distance matrix, around the minimum point of the distance matrix, and clipped to the maximum value of the distance matrix. The fifth column shows 3D visualizations of the fitted bivariate quadratic.

In addition to representing a fit between a tile and its associated image portion, each bivariate quadratic surface fits also represent confidence measures of the fit. Where the surface has a small value on the z-axis (the vertical axis), the confidence of the fit is higher, and where the surface has a larger value on the z-axis, the confidence of the fit is lower.

From FIG. 5, it can be noted that for tiles that are highly textured and distinctive, such as the one in the first row, the distance matrix has a very clear minimum value and the bivariate quadratic fit is curved and well-localized as a result. In the second row, the tile depicts only an edge in the image, the distance matrix has many possible minimum values oriented alongside that edge, and the bivariate quadratic is therefore confident in one axis, but ambiguous in the perpendicular axis. In the third row, where the tile and the image portion is un-textured and mostly flat, the minimum is poorly-localized, as shown by the low curvature of the bivariate quadratic in all directions.

D. Example Information Filtering

In the previous sections, estimating a bivariate quadratic surface for each tile in an image was demonstrated. The bivariate quadratic surface describes the local shape of an error surface, and assumes that the minimum of each error surface was a good estimate of the displacement vector (the offset between pixels) across the two images being matched. These operations provide a per-tile estimate of motion, but do not provide a per-pixel estimate of motion, which is desirable for many applications. This section introduces a technique for applying a linear filter (such as an image upsampling operation or an edge-aware filtering operation) to a set of bivariate quadratic surfaces. In doing so, estimates of per-pixel motion can be obtained.

In order to simplify calculations, it is assumed that each bivariate quadratic surface actually describes the negative log-likelihood of a multivariate normal distribution. A multivariate normal distribution may be parameterized by a vector of means μ and a covariance matrix Σ:

$\begin{matrix} {{P\left( {\left. x \middle| \mu \right.,\Sigma} \right)} = \frac{\exp\left( {{- \frac{1}{2}}\left( {x - \mu} \right)^{T}{\Sigma^{- 1}\left( {x - \mu} \right)}} \right)}{\sqrt{\left( {2\pi} \right)^{k}{\Sigma }}}} & (29) \end{matrix}$

Thus, a set of multivariate normal distributions (i.e., the bivariate quadratic surfaces for each tile in the first image), can be parameterized by means {μ^((i))} and covariance matrixes {Σ^((i))}. A weighted geometric mean (according to a vector of weights w) of these normal distributions can be taken to get a weighted “average” distribution parametrized by means μ and a covariance matrix Σ:

$\begin{matrix} {{P\left( {\left. x \middle| \overset{\_}{\mu} \right.,\overset{\_}{\Sigma}} \right)} \propto {\exp\left( {w_{i}\;{\log\left( {P\left( {\left. x \middle| \mu^{(i)} \right.,\Sigma^{(i)}} \right)} \right)}} \right)}} & (30) \end{matrix}$ Where ∝ is the proportionality symbol (e.g., y∝z means that y=kz for some k). Further:

$\begin{matrix} {\overset{\_}{\Sigma} = \left( {\Sigma_{i}{w_{i}\left( \Sigma^{(i)} \right)}^{- 1}} \right)^{- 1}} & (31) \\ {\overset{\_}{\mu} = {\overset{\_}{\Sigma}\Sigma_{i}{w_{i}\left( \Sigma^{(i)} \right)}^{- 1}\mu^{(i)}}} & (32) \end{matrix}$

Equation (30) is an awkward expression and difficult to manipulate, but can be simplified by re-writing it as an exponentiated polynomial:

$\begin{matrix} {{P\left( {\left. x \middle| A \right.,b} \right)} = {\exp\left( {- \left( {{\frac{1}{2}x^{T}A\; x} + {b^{T}x} + c} \right)} \right)}} & (33) \\ {Where} & \; \\ {A = \sum\limits^{- 1}} & (34) \\ {b = {{- A}\;\mu}} & (35) \\ {c = {\frac{1}{2}\left( {{k\;\log\; 2\pi} - {\log{A}} + {b^{T}A^{- 1}b}} \right)}} & (36) \end{matrix}$

Rewritten as such, this format has the convenient consequence of dramatically simplifying the process of taking a weighted geometric mean of a set of n distributions {A^((i)),b^((i))}: P(x|Ā,b )∝exp(w _(i) log(P(x|A ^((i)) ,b ^((i)))))  (37) Where: Ā=Σ _(i) w _(i) A ^((i))  (38) b=Σ _(i) w _(i) b ^((i))  (39)

The averaged multivariate normal distribution in standard form is the average of the standard-form coefficients of the input distributions. Or put another way, the output parameters are simply a weighted sum of the input parameters. This result is based on the geometric mean of a set of distributions being the average of those distributions in log-space, and that in log-space the distributions are polynomials.

With this insight, a compact vectorised representation of the multivariate normal distributions can be expressed as:

$\begin{matrix} {x^{(i)} = \begin{bmatrix} b^{(i)} \\ {{triu}\left( A^{(i)} \right)} \end{bmatrix}} & (40) \end{matrix}$

Where triu(A) is an operation that returns a k(k+1)/2 dimensional vector containing the upper-triangular part of symmetric matrix A. Similarly, A=triu⁻¹(•) is an operation that takes such a vector and returns a k×k symmetric matrix A. With this vectorized representation of the multivariate normal distributions, the weighted geometric mean of normal distributions can be expressed as: y=Σ _(i) w _(i) x ^((i))  (41) Ā=triu ⁻¹(y[(k+1):end])  (42) μ=−A ⁻¹ y[1:k]  (43)

Assuming for the moment that, in addition to a set of n multivariate normal distributions as input {x^((i))}, it is desirable to determine a set of p multivariate normal distributions as output {y^((j))}, and for each output distribution there is a different set of weights {w^((j))}. Then: y ^((j))=Σ_(i) w _(i) x ^((i))  (44)

This expression can be rewritten as a matrix-matrix product:

$\begin{matrix} \begin{matrix} {X = \left\lbrack {x^{(1)},x^{(2)},x^{(3)},\ldots\mspace{14mu},x^{(n)}} \right\rbrack^{T}} \\ {W = \left\lbrack {w^{(1)},w^{(2)},w^{(3)},\ldots\mspace{14mu},w^{(p)}} \right\rbrack^{T}} \\ {Y = \left\lbrack {y^{(1)},y^{(2)},y^{(3)},\ldots\mspace{14mu},y^{(p)}} \right\rbrack^{T}} \\ {Y = {WX}} \end{matrix} & (45) \end{matrix}$ This results in a filtering approach that is similar to that of a Kalman information filter.

With this matrix formulation of the problem, this process can be re-interpreted in terms of image filtering. Assume that for an image of multivariate normal distributions, each pixel has a mean and a covariance matrix. Based on a linear filtering operation, the set of input normal distributions can be averaged to get a filtered set of output normal distributions. This can be done by constructing an image with (k²+3k)/2 channels using the vectorization operation in Equation (40), which is equivalent to the X matrix in Equation (45). Each channel can be filtered (equivalent to taking the matrix-matrix product WX) to get the output filters. The vectorization operation can be unpacked as described earlier to get the set of per-pixel output multivariate normal distributions.

There is no restriction on W, and W need not be an actual matrix, but can instead by any linear operation (that is, any linear filter or resampling operation). W may be row-stochastic, so that each output normal distribution is a convex combination of the input normal distributions. But, due to the normalization involved in the filter, the value of the output mean of each normal distribution μ is invariant to the scale of the each row of W. So, though W may be row-normalized to produce meaningful precisions, it does not need to be row-normalized to produce accurate output values.

Estimating 2D motion on an image plane is an example of the two-dimensional (k=2) case. Thus, a five-dimensional image can be constructed, in which the first two dimensions are the elements of b^((i)), and the last three dimensions are the three unique values in the precision matrix triu(A^((i))), as shown in Equation (40). After filtering this five-dimensional image, each pixel's estimated motion μ^((i)) can be extracted using the transformation described in Equation (43) on each pixel's five values.

Each dimension loosely corresponds to one the five free parameters of a two-dimensional normal distribution: mean in x, mean in y, variance in x, covariance of x and y, and variance in y. Using Equations (34) and (35), these five quantities are reworked so that they roughly correspond to: precision in x (where precision is the inverse of variance), precision in y, precision in xy, the mean in x decorrelated by the precision matrix, and the mean in y decorrelated by the precision matrix. In some cases, the three precision quantities are the elements of the precision matrix of the normal distribution.

4. EXAMPLE APPLICATIONS

This section provides two example applications, image burst de-noising and edge-aware optical flow, for the techniques disclosed herein. However, other applications may exist that could benefit from these techniques.

A. Image Burst De-Noising

The techniques described herein for matching tiles to image portions can be used as a way of matching image patches across a burst of images for the purpose of de-noising one or more images in the burst. Images captured by some sensors, such as those found on cell phones, tend to produce high amounts of noise, creating unattractive artifacts when the images are viewed at high resolutions. To lower the amount of noise, one could attempt to take a burst of images from the camera and combine (e.g., average) those images together. However, this approach does not always work well on some scenes, as the motion of the camera and of the subjects in the scene means that naively combining frames will cause ghosting. Therefore, the images in the burst should be aligned against a single image from the burst, and then those aligned images can be combined.

Given a burst, a single image is selected from the burst to use as a “template” image. For each m×n (e.g., 32×32) tile in the template image, the previously-described matching procedure is used to align that tile against the corresponding p×q (e.g., 64×64) image region in the other images in the burst. The per-tile bivariate quadratic fits are upsampled with the previously described information filtering technique, where bicubic interpolation is used with each tile's bivariate quadratic surface, and from which the mean offset for each pixel can be extracted (see Equation (45)). Given this estimated per-pixel offset, the other images can be warped into the “template” image, and then the warped images can be combined to create a de-noised image.

For an example of image burst de-noising, see FIG. 6. The first row is a four-frame burst of a scene, in which the camera and the subjects are moving. The second row contains sub-regions of one of the images from the burst, which shows that there is noise in the images. The third row contains the same sub-regions, where naïve combining of the pixel values in the burst has been applied. Though this does reduce noise, but it also causes substantial ghosting due to the motion of the objects. For the fourth row, each image in the burst has been warped into a “template” image, and then the warped images have been combined. These images have low noise and no ghosting.

B. Edge-Aware Optical Flow

Another application is optical flow. Given two images, a flow vector may be assigned to each pixel, where the flow vector represents movement of the pixel from one image to the other. Doing so for some images can be challenging because of the aperture problem. Motion is difficult to locally estimate from two images, because observing the motion of an edge only constrains the motion vector to a one-dimensional subspace of possible flow vectors. To correctly estimate global motion from local motion estimates, the information provided by image edges can be combined, together with the uncertainty inherent in such information, and propagated across an image to resolve flow ambiguities.

Note that for some image patches the aperture problem does not hold. For flat image patches, the motion is entirely unconstrained, and should be modeled accordingly. For highly texture images patches the motion may be entirely constrained in both dimensions. Note that the three types of patches—flat, edge, and texture—are all the same phenomenon viewed at different scales. An image patch containing a small square may be thought of as texture, while a patch containing the inside of a large square may be flat, and a patch of a medium-sized square will likely contain just one edge.

The information filtering technique described above may be used as the backbone of an optical flow algorithm. For every tile in one image, a bivariate normal distribution modeling the well-matched locations in the other image is estimated. Then the flow-field is upsampled to produce a per-pixel flow field, as previously described. An edge-aware filter may be applied, using the same information filtering approach. One filter that can be used is the recursive formulation of a domain transform (though it could be any linear filter). A domain transform is well-suited because it is an edge-aware filter—it propagates information along edges but not across edges. This produces pleasant looking flow fields in which the output flow closely tracks edges in the input image. Such edge-aware flow fields are useful for tracking and segmenting objects, for video retiming, and so on. The edge-aware nature of this filter naturally complements the difficulties of motion estimation. For example, in flat regions of the image where local motion cues are weakest, the domain transform will “in-paint” those regions with the information gained from observing the edges that surround that flat region. See FIG. 4 for an example of this technique in practice.

5. EXAMPLE OPERATIONS

FIGS. 7 and 8 are flow charts illustrating example embodiments. The embodiments illustrated by FIGS. 7 and 8 may be carried out by a computing device, such as digital camera device 100. However, the embodiments can be carried out by other types of devices or device subsystems. Further, the embodiments may be combined with one another and may incorporate any aspect or feature disclosed in this specification or the accompanying drawings.

Block 700 of FIG. 7 may involve obtaining a first captured image of a scene and a second captured image of the scene. Block 702 may involve, for a plurality of m×n pixel tiles of the first captured image, determining respective distance matrixes. The distance matrixes may represent respective fit confidences between the m×n pixel tiles and pluralities of target p×q pixel tiles in the second captured image (e.g., image portions of the second captured image).

In some embodiments, the m×n pixel tiles do not overlap with one another. Further, as an example, the m×n pixel tiles may be 32×32 pixel tiles and the p×q pixel tiles may be 64×64 pixel tiles. Thus, in some cases, m=n and p=q.

Block 704 may involve approximating the distance matrixes with respective bivariate quadratic surfaces. Block 706 may involve upsampling the bivariate quadratic surfaces to obtain respective offsets for pixels in the plurality of m×n pixel tiles, such that the respective offsets, when applied to pixels in the plurality of m×n pixel tiles, cause parts of the first captured image to estimate locations in the second captured image. Upsampling the bivariate quadratic surfaces may involve applying a Kalman filter.

In some embodiments, upsampling the bivariate quadratic surfaces uses bicubic interpolation of respective 3×3 tile regions in the first captured image that surround each respective m×n pixel tile. In these embodiments, one of the first captured image or the second captured image may be selected for warping. Based on the respective offsets, pixels of the selected image may be moved to create a warped image. Then, respective pixel values of the warped image and the non-selected image may be combined to form a de-noised image.

In some embodiments, upsampling the bivariate quadratic surfaces uses an edge-aware filter on respective tile regions in the first captured image that surround each respective m×n pixel tile, and are defined by one or more edges in the first captured image. In these embodiments, an intermediate image that represents intermediate locations of pixels may be interpolated. These pixels may be from the first captured image and the second captured image, and may represent an intermediate version of the scene that is temporally or physically between those of the first captured image and the second captured image. The interpolation may be based on the first captured image, the second captured image, and the respective offsets.

In some embodiments, the first captured image and the second captured image may have been captured less than 1 second apart. Alternatively or additionally, obtaining the first captured image of the scene and the second captured image of the scene may involve capturing, by the computing device, the first captured image and the second captured image.

In some embodiments, one or more entries in each distance matrix are respective minima, and approximating the distance matrixes with respective bivariate quadratic surfaces may involve fitting minima of the respective bivariate quadratic surfaces to the respective minima of the distance matrixes. Fitting minima of the respective bivariate quadratic surfaces to the respective minima of the distance matrixes may involve fitting the respective bivariate quadratic surfaces to respective binomially-weighted 3×3 pixel regions surrounding the respective minima of the distance matrixes.

In some embodiments, a particular distance matrix for a particular m×n pixel tile may be based on a linear combination of (i) a sum of squared values in the particular m×n pixel tile, (ii) squared values in the second captured image filtered by a box filter, and (iii) a cross-correlation of the second captured image and the particular m×n pixel tile.

FIG. 8 is a flow chart of another example embodiment. This embodiment is similar to that of FIG. 7, except that it is directed to alignment of a single tile.

Block 800 of FIG. 8 may involve obtaining a first captured image of a scene and a second captured image of the scene. Block 802 may involve, for an m×n pixel tile of the first captured image, determining a distance matrix. The distance matrix may represent fit confidences between the m×n pixel tile and a plurality of target p×q pixel tiles in the second captured image.

Block 804 may involve approximating the distance matrix with a bivariate quadratic surface. Block 806 may involve upsampling the bivariate quadratic surface to obtain respective offsets for pixels in the m×n pixel tile. The upsampling may take place such that the respective offsets, when applied to pixels in the m×n pixel tile, cause parts of the first captured image to estimate locations in the second captured image.

Additionally, embodiments related to FIG. 8 may include one or more of the features disclosed in the context of FIG. 7, or any other figure.

6. IMPROVED OPTICAL FLOW

The previous sections described, among other aspects, embodiments for taking a per-tile estimate of the motion between two images and quickly upsampling that per-tile flow to produce a per-pixel flow, using just a single image filtering operation in an information-filtering framework. This approach is computationally efficient, but because it is a feed-forward filtering operation, the output per-pixel flow produced might not always be of sufficiently high quality. This section provides an alternative embodiment for producing a per-pixel flow field from a per-tile flow field. This alternative embodiment is designed to produce higher quality results, at the cost of being more expensive to compute.

The embodiment has two parts. The first part takes a per-tile flow (motion) estimate and produces per-pixel flow estimates that may be noisy. But there is a fairly reliable “confidence” measurement for each pixel as to the reliability of the respective flow estimate. The second part takes these noisy per-pixel flow estimates, and from them produces a smooth and accurate flow field as well as a refined per-pixel measure of confidence. These flow estimates for individual image pairs can then be combined into a larger estimate of the motion of all of the frames of a video by assuming that the motion of the objects in the video is temporally smooth.

A. Noisy Per-Pixel Flow Estimates

In this section, a slightly different notation for a tile of an image is used. The term (T_(x),T_(y)) refers to some tile at offset (x,y) in the image. Further, any pixel referred to using the coordinates x and y are assumed to be within tile (T_(x),T_(y)).

From the embodiments of the previous sections, for every tile (T_(x),T_(y)), there is an estimate of that tile's motion that can be modeled by a mean motion vector μ and a precision matrix A of that motion, as well as, d, the squared L2 distance of the patches which produced this motion. From these a per-tile confidence can be estimated:

$\begin{matrix} {{C\left( {T_{x},T_{y}} \right)} = {\exp\left( {{- \frac{d_{patch}}{\sigma_{patch}^{2}}} + \frac{\log{A}}{\sigma_{logdet}}} \right)}} & (46) \end{matrix}$ Where σ_(patch) ² and σ_(log det) are parameters that control which control the relative importance of each term.

In general, the σ parameters herein control the relative importance of each heuristic assumption made about the flow fields (smoothness, fidelity, symmetry, etc.). These parameters may be tuned by hand to produce as accurate a flow field as possible, as determined by visual inspection.

The quantity C(T_(x),T_(y)) is large if the tiles matched (tile (T_(x),T_(y)) of one image and another tile in another image) to produce the flow estimate of tile (T_(x),T_(y)) were well matched (e.g., the error between the two tiles is small), and if the match is well-localized (e.g., the error between the two tiles increases quickly if the estimated movement is altered).

After determining C(T_(x),T_(y)), the confidence measurements can be refined based on each local neighborhood of tiles, using the observation that reliable flow measurements tend to have nearby tiles with similar flow measurements. For each tile, the difference between the estimated flow of the tile and that of one or more of its neighbors can be measured. If none of the neighboring tiles have a similar flow, the confidence in the motion of the tile can be down-weighted. Or, more precisely:

$\begin{matrix} \left. {C\left( {T_{x},T_{y}} \right)}\leftarrow{{C\left( {T_{x},T_{y}} \right)}{\exp\left( \frac{\min\limits_{T_{x}^{\prime},T_{y}^{\prime}}{{{\mu\left( {T_{x},T_{y}} \right)} - {\mu\left( {T_{x}^{\prime},T_{y}^{\prime}} \right)}}}}{\sigma_{neigh}^{2}} \right)}} \right. & (47) \end{matrix}$

Herein, the → operator may be interpreted as “is assigned”—in other words the expression a→b means that a is assigned the value of b. The term (T′_(x),T′_(y)) refers to the neighbors of tile (T_(x),T_(y)). In Equation (47), a minimum is iteratively taken of the L2 distance between tile (T_(x),T_(y)) and these neighbors, and the neighbor with the lowest value is used. For instance, if tile (T_(x),T_(y)) is at an edge or corner where there are less than four immediate neighbors, then only the neighbors present are considered. By exponentiating the negative of the minimum squared L2 distance, the confidence measures of tiles that have no neighbors with a similar estimated motion are down-weighted.

After applying this neighborhood operation to each tile, per-tile flow and confidence estimates can be upsampled to per-pixel flow and confidence estimates. At this point, each pixel could be assigned the flow and confidence of the tile in which that pixel is contained. However, this could result in blocky-looking flow fields that would inherently be inaccurate near object boundaries, where multiple motions are likely present in the same tile. So, in some embodiments, two or more tiles nearby each pixel may be examined (e.g., the tile that the pixel is in as well as neighboring tiles), and each pixel may be assigned to the tile with a motion estimate that best matches the image. That is, for each pixel, the two or more flow estimates are considered, and the matching pixel in the second image that corresponds to each motion is found.

As an example, for a pixel in tile (T_(x),T_(y)), tiles above, below, right, and left of tile (T_(x),T_(y)) may be considered. Then, the pixel is assigned the flow and confidence that produced the best per-pixel match between the two images. For each pixel, the squared L2 distance with the best-matching pixel in the other image, d_(pix)(x,y), may be recorded as well. This distance may be used to update pixel's confidence measure.

As a result, a horizontal per-pixel flow field Ũ(x,y) and a vertical per-pixel flow field {tilde over (V)}(x,y), as well as a per-pixel confidence {tilde over (C)}(x,y), may be found. The latter is the per-tile confidence multiplied by a function of that pixel's matching distance, and can be expressed as:

$\begin{matrix} \left. {\overset{\sim}{C}\left( {x,y} \right)}\leftarrow{{\exp\left( {- \frac{d_{pix}}{\sigma_{pix}^{2}}} \right)}{C\left( {T_{x},T_{y}} \right)}} \right. & (48) \end{matrix}$ FIG. 9 represents an example visualization of this adaptive per-pixel assignment to each tile flow.

Another cue that can be used is symmetry. Assume that two distinct flow fields for a pair of images, one from image A to image B, and the other from image B to image A, are being computed. If the estimated flow from pixel i in image A maps to pixel j in image B, then it may be expected that the estimated flow from pixel j in image B maps back to pixel i in image A. In some embodiments, these “forward” flow estimates may be determined alongside the “backward” flow estimates for all image pairs in a sequence, so the symmetry assumption can be verified. After computing the per-pixel estimated forward flow field (Ũ,{tilde over (V)}) and the corresponding per-pixel estimated confidence {tilde over (C)}, these values can be compared with the corresponding estimated backward flow field (Ũ′,{tilde over (V)}′). For pixels where these flow fields are not symmetric, the confidence may be lowered accordingly. Formally:

$\begin{matrix} {\mspace{79mu}\left. {\overset{\sim}{C}\left( {x,y} \right)}\leftarrow{{\exp\left( {- \frac{d_{sym}}{\sigma_{sym}^{2}}} \right)}{\overset{\sim}{C}\left( {x,y} \right)}} \right.} & (49) \\ {\mspace{79mu}{Where}} & \; \\ {{d_{sym}\left( {x,y} \right)} = {\left( {{\overset{\sim}{U}\left( {x,y} \right)} + {{\overset{\sim}{U}}^{\prime}\left( {{x + {\overset{\sim}{U}\left( {x,y} \right)}},{y + {\overset{\sim}{V}\left( {x,y} \right)}}} \right)}} \right)^{2} + \left( {{\overset{\sim}{V}\left( {x,y} \right)} + {{\overset{\sim}{V}}^{\prime}\left( {{x + {\overset{\sim}{U}\left( {x,y} \right)}},{y + {\overset{\sim}{V}\left( {x,y} \right)}}} \right)}} \right)^{2}}} & (50) \end{matrix}$ The same update can also be applied to the “backward” flow.

The final per-pixel flow field is noisy, but the per-pixel confidence assigned to each pixel is a good indicator of the trustworthiness of that pixel's flow. In the following section an algorithm to smooth out these noisy per-pixel flow estimates into a more reliable flow field is presented.

B. Bilateral-Space Inference

Given an estimated flow field (Ũ,{tilde over (V)}) and per-pixel weights representing the confidence of that flow field {tilde over (C)}, these values can be represented as one-dimensional vectors ũ, {tilde over (v)}, and {tilde over (c)}. An improved version of the flow field (ũ,{tilde over (v)}) and confidence {tilde over (c)} can be found using fast bilateral filtering. In general, bilateral filtering of an image adjusts the values of pixels based on values of similar and nearby pixels in the image. Here, bilateral filtering is used to adjust the estimated flow field of a pixel.

The embodiments herein may use one or more of the following approaches: (1) Both horizontal and vertical flow are found, (2) the data term is represented as a set of univariate normal distributions (means and confidences, where variance in the inverse of confidence), (3) this new data term allows the problem to be rewritten as a system of linear equations that can be solved using a preconditioned conjugate gradient, (4) a Jacobi preconditioner is derived, which allows the solution to converge quickly, and (5) a technique for repeatedly filtering a signal in bilateral space is derived and then used to produce a smoothed confidence measure of the flow field.

First, a global stereo optimization problem may be constructed. In it, a flow field (u,v) for every pixel in the image is found subject to a smoothness term that encourages (u,v) to be smooth, and encourages them to resemble the observed flow (u,v) proportionally to the confidence, {tilde over (c)}, in the observation. Formally, the optimization problem can be stated as finding a solution for the free parameters u and v such that:

$\begin{matrix} {{\min\limits_{u,v}{\frac{\lambda}{2}{\sum\limits_{i,j}{{\hat{W}}_{i,j}\left( {u_{i} - u_{j}} \right)}^{2}}}} + {\frac{\lambda}{2}{\sum\limits_{i,j}{{\hat{W}}_{i,j}\left( {v_{i} - v_{j}} \right)}^{2}}} + {\sum\limits_{i}{w_{i}\left( {v_{i} - {\overset{\sim}{v}}_{i}} \right)}^{2}} + {\sum\limits_{i}{w_{i}\left( {u_{i} - {\overset{\sim}{u}}_{i}} \right)}^{2}}} & (51) \end{matrix}$

This problem decomposes into two independent optimization problems with respect to u and v. For the rest of the description, a solution for p is described, which refers to the per-pixel flow fields u or v respectively. In other words, let {tilde over (p)} refer to ũ or {tilde over (v)} respectively, and the optimization problem can be simplified to seek a solution for the free parameter p such that:

$\begin{matrix} {{\min\limits_{p}{\frac{\lambda}{2}{\sum\limits_{i,j}{{\hat{W}}_{i,j}\left( {p_{i} - p_{j}} \right)}^{2}}}} + {\sum\limits_{i}{w_{i}\left( {p_{i} - {\overset{\sim}{p}}_{i}} \right)}^{2}}} & (52) \end{matrix}$

It is convenient to rewrite this optimization problem in matrix/vector notation:

$\begin{matrix} {{\min\limits_{p}\lambda\;{p^{T}\left( {I - \hat{W}} \right)}p} + {p^{T}{{diag}\left( \overset{\sim}{c} \right)}p} - {2\left( {\overset{\sim}{c}\; \circ \overset{\sim}{p}} \right)^{T}p} + {\left( {\overset{\sim}{c} \circ \overset{\sim}{p}} \right)^{T}\overset{\sim}{p}}} & (53) \end{matrix}$

W is an affinity matrix, where the value of W_(i,j) reflects how smooth the flow field between pixels i and j is expected to be, and where {tilde over (W)} is a bi-stochastic version of the affinity matrix (i.e., the rows and columns of {tilde over (W)} each sum to 1). A bilateral affinity measure for W can be used, where W is defined as:

$\begin{matrix} {W_{i,j} = {\exp\left( {{- \frac{{{\left\lbrack {x_{i},y_{i}} \right\rbrack - \left\lbrack {x_{j},y_{j}} \right\rbrack}}^{2}}{2\sigma_{x\; y}^{2}}} - \frac{{{\left\lbrack {r_{i},g_{i},b_{i}} \right\rbrack - \left\lbrack {r_{j},g_{j},b_{j}} \right\rbrack}}^{2}}{2\sigma_{r\; g\; b}^{2}}} \right)}} & (54) \end{matrix}$

Where the σ_(xy) and σ_(rgb) parameters control the spatial and range bandwidths of the filter, respectively.

The matrix W is an edge-preserving filter that blurs along edges, but not across edges, by locally adapting the filter to the image content. Applying a bilateral filter to a signal x to produce a filtered signal y can be thought of as a normalized matrix-vector multiplication:

$\begin{matrix} {y = \frac{W\; x}{W\; 1}} & (55) \end{matrix}$

The computational efficiency of bilateral filtering can be improved by decomposing the problem in a “splat/blur/slice” procedure. First, pixel values are “splatted” onto a small set of vertices in a grid or lattice (this may involve a soft histogramming operation). Then, those vertex values are blurred, and then the filtered values for each pixel are produced via a “slice” (an interpolation) of the blurred vertex values. This splat/blur/slice procedure corresponds to a factorization of W: W=S ^(T) BS  (56) Where multiplication by S is the “splat”, multiplication by B is the “blur”, and multiplication by S^(T) is the “slice”.

Even though W may be large and dense, by construction S is a short, wide, and sparse matrix, and B is small and sparse. B may be a product of several sparse matrices (though it can be treated as a single matrix for convenience). While the naïve filtering of Equation (55) is often intractably slow, this factorization allows for fast filtering:

$\begin{matrix} {\frac{W\; x}{W\; 1} = \frac{S^{T}\left( {\overset{\_}{B}\left( {S(x)} \right)} \right)}{S^{T}\left( {\overset{\_}{B}\left( {S(1)} \right)} \right)}} & (57) \end{matrix}$

Thus, W can be expressed as a matrix factorization by performing a variable substitution which reformulates the problem in terms of vertices instead of pixels: p=S ^(T) q  (58) Where q is a small vector of values for each bilateral-space vertex, while p is a larger vector of values for each pixel.

The same substitution can be performed to solve a similar optimization problem in bilateral space to recover q*, and from that a per-pixel solution can be produced: p*=S ^(T) q*  (59)

The previously discussed matrix factorization was phrased in terms of the affinity matrix W, but it is more convenient to work with the bi-stochastic affinity matrix Ŵ, which is why the optimization problem is framed in terms of Ŵ. To produce Ŵ from W, the technique shown in Algorithm 1 (see FIG. 10) may be used. This procedure results in a set of diagonal matrices which can be used throughout the algorithm to perform various operations in bilateral space instead of pixel space.

These bilateral-space diagonal bi-stochastization matrices allow description of Ŵ, the bi-stochasticized version of W, in terms of splat/blur/slice factorization: Ŵ=S ^(T) D _(r) BD _(r) S  (60)

Further, these bi-stochastization matrices also allow the pixel-space loss function in Equation (53) to be expressed in bilateral space:

$\begin{matrix} {{\min\limits_{q}{\frac{1}{2}q^{T}A\; q}} - {b^{T}q} + c} & (61) \\ \text{Where:~~~~} & \; \\ {A = {{\lambda\left( {D_{m} - {D_{n}\overset{\_}{B}D_{n}}} \right)} + {{diag}\left( {S\overset{\sim}{c}} \right)}}} & (62) \\ {b = {S\left( {\overset{\sim}{c}\mspace{14mu}\bullet\mspace{14mu}\overset{\sim}{p}} \right)}} & (63) \\ {c = {\frac{1}{2}\left( {\overset{\sim}{c}\mspace{14mu}\bullet\mspace{14mu}\overset{\sim}{p}} \right)^{T}\overset{\sim}{p}}} & (64) \end{matrix}$

Equations (61)-(64) can be solved using preconditioned conjugate gradient descent with a Jacobi preconditioner. To produce a Jacobi preconditioner, the diagonal of the A matrix can be computed, which can be done analytically: diag(A)=λ(D _(m) −D _(n)diag( B )D _(n))+S{tilde over (c)}  (65)

This computation can be performed directly, as D_(m) and D_(n) are already diagonal matrices, and B has a constant value along the diagonal. With this, a Jacobi preconditioner can be found by taking the inverse of the values along the diagonal of A: P ⁻¹=diag(A)⁻¹  (66)

With this preconditioner, Equations (61)-(64) can be solved efficiently using the preconditioned conjugate gradient method (PCG). PCG usually converges in 10-30 iterations, while non-preconditioned CG can take thousands of iterations to converge. Once Equations (61)-(64) have been optimized in bilateral-space to produce q*, that value can be sliced using Equation (59) to obtain p*=S^(T)q*. As noted above, two distinct optimization problems are solved, one to get a smoothed horizontal flow-field u* and another to get a smoothed vertical flow-field v*.

In addition to producing a smoothed estimate of the flow fields, a smoothed estimate of confidence in the smoothed flow fields may also be derived. Smoothed confidence weights can be obtained by repeatedly applying a bilateral filter to the noisy input weights e. Naïvely, this can be done by repeatedly multiplying the bi-stochastic affinity matrix Ŵ with c, but this is computationally expensive. As an efficient alternative, the confidence map can be repeatedly filtered entirely in bilateral-space.

To that end, the process of repeatedly filtering a signal x with the bi-stochastic affinity matrix W to produce a filtered signal y can be expressed as: x=Ŵ ^(n) x=Ŵ({circumflex over (W)}( . . . (Ŵx) . . . ))  (67)

For the case where n=2, this multiplication can be written in terms of the factorization of Ŵ:

$\begin{matrix} \begin{matrix} {{\hat{W}}^{2} = {\left( {S^{T}D_{r}\overset{\_}{B}D_{r}S} \right)\left( {S^{T}D_{r}\overset{\_}{B}D_{r}S} \right)}} \\ {= {S^{T}D_{r}\overset{\_}{B}D_{r}D_{m}D_{r}\overset{\_}{B}D_{r}S}} \\ {= {S^{T}D_{m}^{- \frac{1}{2}}D_{m}^{\frac{1}{2}}D_{r}\overset{\_}{B}D_{r}D_{m}^{\frac{1}{2}}D_{m}^{\frac{1}{2}}D_{r}\overset{\_}{B}D_{r}D_{m}^{\frac{1}{2}}D_{m}^{- \frac{1}{2}}S}} \\ {= {S^{T}{D_{m}^{- \frac{1}{2}}\left( {D_{m}^{\frac{1}{2}}D_{r}\overset{\_}{B}D_{r}D_{m}^{\frac{1}{2}}} \right)}^{2}D_{m}^{- \frac{1}{2}}S}} \end{matrix} & (68) \end{matrix}$

This refactorization can be generalized to an arbitrary value of n: Ŵ ^(n) =S ^(T) D _(s)(D _(b) BD _(b))^(n) D _(s) S  (69)

Note that Equations (68)-(69) use some of the diagonal matrices that were computed using Algorithm 1. With this factorization, a signal x can be efficiently filtered with Ŵ n times by multiplying x with this factorized representation of Ŵ^(n), as is shown in Algorithm 2 (see FIG. 11). This repeated-filtering technique can be used to compute a smoothed confidence image c from the noisy input confidence {tilde over (c)}.

The splat/blur/slice factorization of the bilateral affinity matrix is the simplified bilateral grid. This data structure is efficient to compute and use, but it has the unfortunately side-effect of introducing “blocky” grid-shaped artifacts in the output flow and confidence images. To ameliorate this, the estimated flow and confidence can be filtered using a domain transform to smooth out these blocky artifacts.

A visualization of the flow fields and confidence estimates before and after this bilateral-space inference procedure are represented in FIG. 12. In the first row of FIG. 12 there are two input images. The second row depicts coarse estimated per-pixel flow and confidence images, computed from the per-tile flow. The third row depicts the smoothed flow and confidence produced by the bilateral-space inference. The last row demonstrates that the per-pixel flow does a good job of matching the two images, by contrasting a warped composite with a naïve composite of these images.

C. Temporal Smoothing

Motion estimation techniques such as those described herein can be applied to entire video sequences of many frames. When processing a complete video, it would be desirable to produce motion estimates for each frame that are not only smooth and consistent within each frame (by using the bilateral-space inference technique) but are also smooth and consistent across frames. This is useful for many applications, as solving for a flow-field for all pairs of images independently in a video sequence can often produce shaking or flickering artifacts in the flow fields, which may in turn produce artifacts in any graphics application that relies on these flow fields.

There are two extensions to the embodiments herein that produce temporally-smooth motion estimates. The first is a computationally efficient modification to the per-frame solution, in which pairs of frames are processed in sequence, and in which the estimated flow from image t−1 to image t is used to inform the estimate of the flow from image t to image t+1.

Solving for the flow from image t−1 to image t results in a post-processed (smooth) flow field (U_(t),V_(t)) and confidence C_(t). Then, the flow from image t to image t+1 is processed. First, a rough flow field (Ũ_(t+1),{tilde over (V)}_(t+1)) and an associated confidence {tilde over (C)}_(t+1) are estimated. Then, before applying the bilateral inference to this flow field, it may be combined with the post-processed flow from time t.

$\begin{matrix} \left. {\overset{\sim}{U}}_{t + 1}\leftarrow\frac{{\left( {\alpha\; C_{t}} \right) \times U_{t}} + {\left( {\left( {1 - \alpha} \right){\overset{\sim}{C}}_{t + 1}} \right) \times {\overset{\sim}{U}}_{t}}}{\left( {\alpha\; C_{t}} \right) + \left( {\left( {1 - \alpha} \right){\overset{\sim}{C}}_{t + 1}} \right)} \right. & (70) \\ \left. {\overset{\sim}{V}}_{t + 1}\leftarrow\frac{{\left( {\alpha\; C_{t}} \right) \times V_{t}} + {\left( {\left( {1 - \alpha} \right){\overset{\sim}{C}}_{t + 1}} \right) \times {\overset{\sim}{V}}_{t}}}{\left( {\alpha\; C_{t}} \right) + \left( {\left( {1 - \alpha} \right){\overset{\sim}{C}}_{t + 1}} \right)} \right. & (71) \\ \left. {\overset{\sim}{C}}_{t + 1}\leftarrow{\left( {\alpha\; C_{t}} \right) + \left( {\left( {1 - \alpha} \right){\overset{\sim}{C}}_{t + 1}} \right)} \right. & (72) \end{matrix}$

In Equations (70)-(72), α is a scalar that controls the relative performance of the last frame's flow versus the current′ frame's flow, and can be tuned accordingly (in some embodiments α=0.5, but α can take on other values, e.g., in the range of 0.5 to 0.9). This process is an inverse-variance weighting, where the confidences C are treated as inverse-variance.

This technique has many benefits. The model of temporal smoothness is causal, in that the estimate of the motion at time t+1 is only a function of the observed motions at all times <t+1. This model also has an infinite support, in that the motion estimated for time t+1 considers the motions for all times <t+1, which makes the estimated motion very smooth and stable in time. This technique is also simple to implement, computationally inexpensive, and memory efficient, as all frames are processed independently in order and the only communication across frames t+1 and t is just the last estimated motion and confidence at time t. In some cases, when processing a sequence of frames, the first few frames of the sequence may have unstable, “shaky” motion estimates because the causal nature of this filter means that early frames have no prior motion estimates to stabilize themselves. So, when using this technique, the first few frames of a sequence may be discarded.

A second technique for temporally-consistent motion estimation of a video sequence may also be used. Instead of solving for the motion of each frame independently in a serial order, this technique solves for all motions of all frames in one joint optimization problem. The approach is similar to the bilateral inference technique discussed above. To review, the single-frame technique optimizes over a bilateral-space representation of a single image, and performs inference in a sparse five-dimensional representation—each pixel's color (red, green, blue) and spatial location (x-coordinate, y-coordinate). In this grid representation, each vertex is connected to its adjacent vertices, which is what induces smoothness in the estimated depth. To generalize from a single image to a video, each frame is augmented with an additional dimension t, such that each pixel exists in a 6-dimensional space in which pixels are not only connected to nearby pixels with similar colors, but are also connected to pixels in adjacent frames in time with similar colors and positions. The same or a similar inference procedure that was detailed previously can be performed to produce a single motion estimate for a sequence of frames or an entire video.

This joint approach has several benefits over the per-frame approach. The motion estimates are generally more stable, as the inference procedure is able to look at all frames simultaneously when estimating motion, while the per-frame approach only considers a single image at a time. The joint approach is also computationally efficient, as solving for all frames jointly avoids much of the redundant computation that is performed when processing all frames individually.

D. Example Operations

FIG. 13 is a flow chart illustrating an example embodiment. The embodiment illustrated by FIG. 13 may be carried out by a computing device, such as digital camera device 100. However, the embodiments can be carried out by other types of devices or device subsystems. Further, the embodiments of FIG. 13 may be combined with those of FIGS. 7 and 8, and may incorporate any aspect or feature disclosed in this specification or the accompanying drawings.

Block 1300 of FIG. 13 may involve determining a per-tile motion estimate between a first m×n pixel tile from a first captured image of a scene and a second m×n pixel tile from a second captured image of the scene. The per-tile motion estimate may represent movement of the first m×n pixel tile to approximate the second m×n pixel tile. The per-tile motion estimate may be based on a motion vector and a precision matrix of the motion vector.

Block 1302 may involve, possibly based on the approximation of the first m×n pixel tile to the second m×n pixel tile, estimating a per-tile confidence of the per-tile motion estimate. Estimating the per-tile confidence of the per-tile motion estimate may involve (i) measuring similarities between the per-tile motion estimate and respective per-tile motion estimates of two or more tiles that are adjacent, in the first captured image, to the first m×n pixel tile, and (ii) adjusting the estimated the per-tile confidence based on the measured similarities. The measured similarities may be based on respective exponentiated L2 distances between the per-tile motion estimate and the respective per-tile motion estimates of the two or more tiles that are adjacent, in the first captured image, to the first m×n pixel tile.

Block 1304 may involve upsampling the per-tile motion estimate and the per-tile confidence to obtain respective per-pixel motion estimates and associated per-pixel confidences for pixels of the first m×n pixel tile.

Block 1306 may involve iteratively filtering the respective per-pixel motion estimates and associated per-pixel confidences. The iterative filtering may involve multiplying the respective per-pixel motion estimates and associated per-pixel confidences by an affinity matrix. The iterative filtering may also smooth the respective per-pixel motion estimates and associated per-pixel confidences.

In some embodiments, the affinity matrix may represent respective L2 distances between locations and color channel pixels in the first captured image and pixels in the second captured image. Alternatively or additionally, the affinity matrix may be a bi-stochastic matrix.

In some embodiments, a particular per-pixel motion estimate of a particular pixel in the first captured image may be based on per-tile motion estimates of at least two tiles in the first captured image. The particular per-pixel motion estimate may be assigned such that the particular pixel is matched with a target pixel in the second captured image, wherein the target pixel is not located in the second m×n pixel tile.

In some embodiments, one or more per-pixel confidences may be adjusted. For instance, it may be determined that a first per-pixel motion estimate of a first pixel in the first captured image indicates that the first pixel is matched to a second pixel in the second captured image. A second per-pixel motion estimate of the second pixel that matches the second pixel to a third pixel in the first captured image may be obtained. It may be determined that the first pixel is different from the third pixel. Possibly based on the first pixel being different from the third pixel, a per-pixel confidence of the first per-pixel motion estimate may be lowered.

In some embodiments, the first captured image, the second captured image, and a third captured image are sequential frames of a sequence of video frames. A second per-tile motion estimate between a third m×n pixel tile from the second captured image and a fourth m×n pixel tile from the third captured image may be determined. The second per-tile motion estimate may represent movement of the third m×n pixel tile to approximate the fourth m×n pixel tile. Possibly based on the approximation of the third m×n pixel tile to the fourth m×n pixel tile, a second per-tile confidence of the second per-tile motion estimate may be obtained. The second per-tile motion estimate and the second per-tile confidence may be upsampled to obtain respective second per-pixel motion estimates and associated second per-pixel confidences for pixels of the third m×n pixel tile. The respective second per-pixel motion estimates and associated second per-pixel confidences may also based on the respective smoothed per-pixel motion estimates and associated smoothed per-pixel confidences for pixels of the first m×n pixel tile.

In some embodiments, the first captured image and the second captured image are sequential frames of a sequence of video frames. Each pixel of the first captured image may be represented in 6-dimensional space. The 6 dimensions may include x and y locations of the respective pixels, 3 color channel values of the respective pixels, and a frame number of the respective pixels. The upsampling and the iterative filtering may consider per-pixel motion estimates and associated per-pixel confidences from each frame in the sequence of video frames.

7. CONCLUSION

The present disclosure is not to be limited in terms of the particular embodiments described in this application, which are intended as illustrations of various aspects. Many modifications and variations can be made without departing from its scope, as will be apparent to those skilled in the art. Functionally equivalent methods and apparatuses within the scope of the disclosure, in addition to those enumerated herein, will be apparent to those skilled in the art from the foregoing descriptions. Such modifications and variations are intended to fall within the scope of the appended claims.

The above detailed description describes various features and functions of the disclosed systems, devices, and methods with reference to the accompanying figures. The example embodiments described herein and in the figures are not meant to be limiting. Other embodiments can be utilized, and other changes can be made, without departing from the scope of the subject matter presented herein. It will be readily understood that the aspects of the present disclosure, as generally described herein, and illustrated in the figures, can be arranged, substituted, combined, separated, and designed in a wide variety of different configurations, all of which are explicitly contemplated herein.

With respect to any or all of the message flow diagrams, scenarios, and flow charts in the figures and as discussed herein, each step, block, and/or communication can represent a processing of information and/or a transmission of information in accordance with example embodiments. Alternative embodiments are included within the scope of these example embodiments. In these alternative embodiments, for example, functions described as steps, blocks, transmissions, communications, requests, responses, and/or messages can be executed out of order from that shown or discussed, including substantially concurrent or in reverse order, depending on the functionality involved. Further, more or fewer blocks and/or functions can be used with any of the ladder diagrams, scenarios, and flow charts discussed herein, and these ladder diagrams, scenarios, and flow charts can be combined with one another, in part or in whole.

A step or block that represents a processing of information can correspond to circuitry that can be configured to perform the specific logical functions of a herein-described method or technique. Alternatively or additionally, a step or block that represents a processing of information can correspond to a module, a segment, or a portion of program code (including related data). The program code can include one or more instructions executable by a processor for implementing specific logical functions or actions in the method or technique. The program code and/or related data can be stored on any type of computer readable medium such as a storage device including a disk, hard drive, or other storage medium.

The computer readable medium can also include non-transitory computer readable media such as computer-readable media that store data for short periods of time like register memory, processor cache, and random access memory (RAM). The computer readable media can also include non-transitory computer readable media that store program code and/or data for longer periods of time. Thus, the computer readable media may include secondary or persistent long term storage, like read only memory (ROM), optical or magnetic disks, compact-disc read only memory (CD-ROM), for example. The computer readable media can also be any other volatile or non-volatile storage systems. A computer readable medium can be considered a computer readable storage medium, for example, or a tangible storage device.

Moreover, a step or block that represents one or more information transmissions can correspond to information transmissions between software and/or hardware modules in the same physical device. However, other information transmissions can be between software modules and/or hardware modules in different physical devices.

The particular arrangements shown in the figures should not be viewed as limiting. It should be understood that other embodiments can include more or less of each element shown in a given figure. Further, some of the illustrated elements can be combined or omitted. Yet further, an example embodiment can include elements that are not illustrated in the figures.

Additionally, any enumeration of elements, blocks, or steps in this specification or the claims is for purposes of clarity. Thus, such enumeration should not be interpreted to require or imply that these elements, blocks, or steps adhere to a particular arrangement or are carried out in a particular order.

While various aspects and embodiments have been disclosed herein, other aspects and embodiments will be apparent to those skilled in the art. The various aspects and embodiments disclosed herein are for purposes of illustration and are not intended to be limiting, with the true scope being indicated by the following claims. 

What is claimed is:
 1. A method comprising: determining, by a computing device, a per-tile motion estimate between a first m×n pixel tile from a first captured image of a scene and a second m×n pixel tile from a second captured image of the scene, wherein the per-tile motion estimate represents movement of the first m×n pixel tile to approximate the second m×n pixel tile; based on the approximation of the first m×n pixel tile to the second m×n pixel tile, estimating a per-tile confidence of the per-tile motion estimate; upsampling the per-tile motion estimate and the per-tile confidence to obtain respective per-pixel motion estimates and associated per-pixel confidences for pixels of the first m×n pixel tile; and iteratively filtering, by the computing device, the respective per-pixel motion estimates and associated per-pixel confidences, wherein the iterative filtering involves multiplying the respective per-pixel motion estimates and associated per-pixel confidences by an affinity matrix, and wherein the iterative filtering smoothes the respective per-pixel motion estimates and associated per-pixel confidences.
 2. The method of claim 1, wherein the per-tile motion estimate is based on a motion vector and a precision matrix of the motion vector.
 3. The method of claim 1, wherein estimating the per-tile confidence of the per-tile motion estimate comprises: measuring similarities between the per-tile motion estimate and respective per-tile motion estimates of two or more tiles that are adjacent, in the first captured image, to the first m×n pixel tile; and adjusting the estimated the per-tile confidence based on the measured similarities.
 4. The method of claim 3, wherein the measured similarities are based on respective exponentiated L2 distances between the per-tile motion estimate and the respective per-tile motion estimates of the two or more tiles that are adjacent, in the first captured image, to the first m×n pixel tile.
 5. The method of claim 1, wherein a particular per-pixel motion estimate of a particular pixel in the first captured image is based on per-tile motion estimates of at least two tiles in the first captured image, and wherein the particular per-pixel motion estimate is assigned such that the particular pixel is matched with a target pixel in the second captured image, wherein the target pixel is not located in the second m×n pixel tile.
 6. The method of claim 1, further comprising: determining that a first per-pixel motion estimate of a first pixel in the first captured image indicates that the first pixel is matched to a second pixel in the second captured image; obtaining a second per-pixel motion estimate of the second pixel that matches the second pixel to a third pixel in the first captured image; determining that the first pixel is different from the third pixel; and based on the first pixel being different from the third pixel, lowering a per-pixel confidence of the first per-pixel motion estimate.
 7. The method of claim 1, wherein the affinity matrix represents respective L2 distances between locations and color channels pixels in the first captured image and pixels in the second captured image.
 8. The method of claim 1, wherein the affinity matrix is a bi-stochastic matrix.
 9. The method of claim 1, wherein the first captured image, the second captured image, and a third captured image are sequential frames of a sequence of video frames, the method further comprising: determining a second per-tile motion estimate between a third m×n pixel tile from the second captured image and a fourth m×n pixel tile from the third captured image, wherein the second per-tile motion estimate represents movement of the third m×n pixel tile to approximate the fourth m×n pixel tile; based on the approximation of the third m×n pixel tile to the fourth m×n pixel tile, estimating a second per-tile confidence of the second per-tile motion estimate; and upsampling the second per-tile motion estimate and the second per-tile confidence to obtain respective second per-pixel motion estimates and associated second per-pixel confidences for pixels of the third m×n pixel tile, wherein the respective second per-pixel motion estimates and associated second per-pixel confidences are also based on the respective smoothed per-pixel motion estimates and associated smoothed per-pixel confidences for pixels of the first m×n pixel tile.
 10. The method of claim 1, wherein the first captured image and the second captured image are sequential frames of a sequence of video frames, the method further comprising: representing each pixel of the first captured image in 6-dimensional space, wherein the 6 dimensions include x and y locations of the respective pixels, 3 color channel values of the respective pixels, and a frame number of the respective pixels, wherein the upsampling and the iterative filtering considers per-pixel motion estimates and associated per-pixel confidences from each frame in the sequence of video frames.
 11. A computing device comprising: at least one processor; memory; and program instructions, stored in the memory, that upon execution by the at least one processor cause the computing device to perform operations comprising: determining a per-tile motion estimate between a first m×n pixel tile from a first captured image of a scene and a second m×n pixel tile from a second captured image of the scene, wherein the per-tile motion estimate represents movement of the first m×n pixel tile to approximate the second m×n pixel tile; based on the approximation of the first m×n pixel tile to the second m×n pixel tile, estimating a per-tile confidence of the per-tile motion estimate; upsampling the per-tile motion estimate and the per-tile confidence to obtain respective per-pixel motion estimates and associated per-pixel confidences for pixels of the first m×n pixel tile; and iteratively filtering the respective per-pixel motion estimates and associated per-pixel confidences, wherein the iterative filtering involves multiplying the respective per-pixel motion estimates and associated per-pixel confidences by an affinity matrix, and wherein the iterative filtering smoothes the respective per-pixel motion estimates and associated per-pixel confidences.
 12. The computing device of claim 11, wherein estimating the per-tile confidence of the per-tile motion estimate comprises: measuring similarities between the per-tile motion estimate and respective per-tile motion estimates of two or more tiles that are adjacent, in the first captured image, to the first m×n pixel tile; and adjusting the estimated the per-tile confidence based on the measured similarities.
 13. The computing device of claim 12, wherein the measured similarities are based on respective exponentiated L2 distances between the per-tile motion estimate and the respective per-tile motion estimates of the two or more tiles that are adjacent, in the first captured image, to the first m×n pixel tile.
 14. The computing device of claim 11, wherein a particular per-pixel motion estimate of a particular pixel in the first captured image is based on per-tile motion estimates of at least two tiles in the first captured image, and wherein the particular per-pixel motion estimate is assigned such that the particular pixel is matched with a target pixel in the second captured image, wherein the target pixel is not located in the second m×n pixel tile.
 15. The computing device of claim 11, the operations further comprising: determining that a first per-pixel motion estimate of a first pixel in the first captured image indicates that the first pixel is matched to a second pixel in the second captured image; obtaining a second per-pixel motion estimate of the second pixel that matches the second pixel to a third pixel in the first captured image; determining that the first pixel is different from the third pixel; and based on the first pixel being different from the third pixel, lowering a per-pixel confidence of the first per-pixel motion estimate.
 16. The computing device of claim 11, wherein the affinity matrix represents respective L2 distances between locations and color channel of pixels in the first captured image and pixels in the second captured image.
 17. The computing device of claim 11, wherein the affinity matrix is a bi-stochastic matrix.
 18. The computing device of claim 11, wherein the first captured image, the second captured image, and a third captured image are sequential frames of a sequence of video frames, the operations further comprising: determining a second per-tile motion estimate between a third m×n pixel tile from the second captured image and a fourth m×n pixel tile from the third captured image, wherein the second per-tile motion estimate represents movement of the third m×n pixel tile to approximate the fourth m×n pixel tile; based on the approximation of the third m×n pixel tile to the fourth m×n pixel tile, estimating a second per-tile confidence of the second per-tile motion estimate; and upsampling the second per-tile motion estimate and the second per-tile confidence to obtain respective second per-pixel motion estimates and associated second per-pixel confidences for pixels of the third m×n pixel tile, wherein the respective second per-pixel motion estimates and associated second per-pixel confidences are also based on the respective smoothed per-pixel motion estimates and associated smoothed per-pixel confidences for pixels of the first m×n pixel tile.
 19. The computing device of claim 11, wherein the first captured image and the second captured image are sequential frames of a sequence of video frames, the operations further comprising: representing each pixel of the first captured image in 6-dimensional space, wherein the 6 dimensions include x and y locations of the respective pixels, 3 color channel values of the respective pixels, and a frame number of the respective pixels, wherein the upsampling and the iterative filtering considers per-pixel motion estimates and associated per-pixel confidences from each frame in the sequence of video frames.
 20. An article of manufacture including a non-transitory computer-readable medium, having stored thereon program instructions that, upon execution by a computing device, cause the computing device to perform operations comprising: determining a per-tile motion estimate between a first m×n pixel tile from a first captured image of a scene and a second m×n pixel tile from a second captured image of the scene, wherein the per-tile motion estimate represents movement of the first m×n pixel tile to approximate the second m×n pixel tile; based on the approximation of the first m×n pixel tile to the second m×n pixel tile, estimating a per-tile confidence of the per-tile motion estimate; upsampling the per-tile motion estimate and the per-tile confidence to obtain respective per-pixel motion estimates and associated per-pixel confidences for pixels of the first m×n pixel tile; and iteratively filtering the respective per-pixel motion estimates and associated per-pixel confidences, wherein the iterative filtering involves multiplying the respective per-pixel motion estimates and associated per-pixel confidences by an affinity matrix, and wherein the iterative filtering smoothes the respective per-pixel motion estimates and associated per-pixel confidences. 